Skip to content

feat: config types#128

Merged
branchseer merged 13 commits intomainfrom
01-23-feat_config_types
Jan 23, 2026
Merged

feat: config types#128
branchseer merged 13 commits intomainfrom
01-23-feat_config_types

Conversation

@branchseer
Copy link
Copy Markdown
Member

@branchseer branchseer commented Jan 23, 2026

Add TypeScript type definitions for task configuration

This PR adds TypeScript type definitions for the task configuration schema used in vite.config.* files. The types are generated using the ts-rs crate and are included as a static file in the repository.

Key changes:

  • Add ts-rs dependency with feature flags to make it optional
  • Implement TS trait for Str and RelativePathBuf (both map to TypeScript's string)
  • Add TypeScript type annotations to all user config structs
  • Convert UserConfigTasks to a newtype pattern for better TS support
  • Include generated TypeScript definition file at crates/vite_task_graph/task-config.ts
  • Add test to verify generated TypeScript matches the committed file

The TypeScript definitions provide better editor support when users are editing their task configurations in TypeScript/JavaScript-based config files.

branchseer and others added 6 commits January 23, 2026 16:33
Add ts-rs based TypeScript type generation for UserConfigTasks under
a new 'ts-types' feature flag. This enables generating TypeScript
definitions for the vite.config.json task configuration schema.

- Add ts-rs dependency to workspace
- Implement TS trait for Str and RelativePathBuf (map to 'string')
- Add TS derives to all user config types with MustBe! overrides
- Convert UserConfigTasks to newtype for TS derive support
- Add 'config-types' CLI subcommand to print generated types

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…k_graph

Move TypeScript type generation support behind feature flags to reduce
compile-time dependencies for production builds. The ts-rs dependency
is now only needed when running tests.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy link
Copy Markdown
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@branchseer branchseer marked this pull request as ready for review January 23, 2026 10:53
branchseer and others added 4 commits January 23, 2026 19:12
Replace the Rust dprint-plugin-typescript crate with oxfmt CLI for
formatting generated TypeScript types. This removes a heavy Rust
dependency and uses the faster oxfmt formatter via subprocess.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@branchseer branchseer requested a review from fengmk2 January 23, 2026 11:57
branchseer and others added 3 commits January 23, 2026 20:20
Replace `#[serde(default)]` with `Option<T>` for config fields so they
generate as optional (`?:`) in TypeScript. This allows users to omit
fields like `cwd`, `dependsOn`, `envs`, and `passThroughEnvs` in their
config files.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Separates each lint command into its own step for better visibility
in CI logs when a specific check fails.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@branchseer branchseer merged commit d1824f2 into main Jan 23, 2026
7 checks passed
@branchseer branchseer deleted the 01-23-feat_config_types branch January 23, 2026 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant